let innerHtml = '<p>The {{ name.old }} is opened at {{ year }}.</p>';

let data = {
	name: {
		old: 'Jax'
	},
	year: '1996'
};

template(innerHtml, data);

function template(str, obj) {
	let regExp = /\{\{([^\}\}]+)?\}\}/g;
	let result = str.replace(regExp, function (m, g) {
		// console.log(arguments);
		return eval('obj.'+g.trim()) || '';
	});
	console.log(result);
}